<Code Lib>
2025.3 Method
Changes 0
M

Document.Delete(ICollection<ElementId>)

Description:
Deletes a set of elements from the document.
Remarks:
This method will delete the elements and any elements that are totally dependent upon that element. Any references to the deleted elements will become invalid and hence cause an exception to be thrown if they are accessed. The elements will be deleted with no prompts for user confirmation. Pinned elements will be deleted with no warnings.

Note: in a family document, the predefined elements (those elements inherited from its family template file) can't be deleted by this method.

Overloads (2):
Delete(ICollection[ElementId])

public ICollection<ElementId> Delete(
	ICollection<ElementId> elementIds
)

  • ICollection<ElementId>
    elementIds
    The ids of the elements to delete.
Return Value ICollection<ElementId> ICollection ElementId

  • One or more elements in elementIds do not exist in the document. -or- One or more of the elementIds cannot be deleted.
  • A non-optional argument was null
  • The document is in failure mode: an operation has failed, and Revit requires the user to either cancel the operation or fix the problem (usually by deleting certain elements). -or- The document is being loaded, or is in the midst of another sensitive process.
  • The document has no open transaction.

Loading…